package com.lcc.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

// @Order(1) 切面器执行顺序
@Slf4j
@Component
@Aspect
public class MyAspect {

    /*@Pointcut("execution(* com.lcc.service.impl.DeptServiceImpl.*(..))") //切点
    public void qd() {}

    @Before("qd()")  // .*=类 (..)表示参数
    public void before() {
        log.info("before...");
    }

    @Around("qd()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

        log.info("around before...");
        //调用目标对象的原始方法执行
        Object result = proceedingJoinPoint.proceed();

        log.info("around after...");
        return result;
    }

    @After("qd()")
    public void after() {
        log.info("after...");
    }

    @AfterReturning("qd()")
    public void afterReturning() {
        log.info("afterReturning...");
    }

    @AfterThrowing("qd()")
    public void afterThrowing() {
        log.info("afterThrowing...");
    }*/
}
